package com.Day3;

public class PalindromesPrime {
    public static void main(String[] args) {
        int num;
        int count;
        int x = 1;
        for (num = 1, count = 0; count <= 100; num++){
         if (isPalindromes(num) && isPrime(num)){
             count++;
             x++;
             System.out.print(num + " ");
             if (x % 10 ==0){
                 System.out.println("");
             }
         }
        }
    }

    public static boolean isPrime(int n){
        if (n < 2){
            return false;
        }
        for(int i = 2; i < n; i++){
            if (n % i == 0){
                return false;
            }
        }
        return true;
    }//判断素数

    public static boolean isPalindromes(int m){
        String word = String.valueOf(m);
        final StringBuilder builder = new StringBuilder(word);
        if(builder.reverse().toString().equals(word)){
            return true;
        }
        return false;
        }
        }//判断回文数


